import jieba
import wordcloud
import matplotlib.pyplot as plt
import numpy as np

strs = '关键词是可以表征全文主题内容信息的词语，一般通过人工标注或计算机自动抽取方法'
words = jieba.lcut(strs)
words = ''.join(words)
img = plt.imread("heart.jpg")  # 加载图片车,
img = img.astype(np.uint8)
wc = wordcloud.WordCloud(background_color='white', font_path='msyh.ttc', height=600, width=800, mask=img)
wc.generate(words)
wc.to_file('img.png')
